<%--
  Created by IntelliJ IDEA.
  User: Albert Lee
  Date: 2020/5/25
  Time: 9:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户列表</title>
</head>
<body>
<%
    Class.forName("com.mysql.jdbc.Driver");
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/kongdechang","root","root");
    Statement statement=con.createStatement();

    ResultSet rs=statement.executeQuery("SELECT * FROM user");
//sql.execute("SELECT*FROM user");
//rs.next();
%>
<table border="1">
    <tr><td>用户id</td><td>用户名</td><td>密码</td></tr>
        <%
while(rs.next()){
    <tr>
        <td><%out.println(rs.getInt("id"));%></td>
        <td><%out.println(rs.getString("username"));%></td>
        <td><%out.println(rs.getString("password"));%></td>
    </tr>
    <%
        }
        rs.close();
        statement.close();
        con.close();
    %>
</table>
</body>
</html>
